<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>品牌添加</title>
    <link href="../../lib/layui-v2.6.3/css/layui.css" media="all" rel="stylesheet">
    <link href="../../css/public.css" media="all" rel="stylesheet">
    <link href="../../css/diy/form1.css" rel="stylesheet">
    <script src="../../lib/layui-v2.6.3/layui.js"></script>
    <script src="../../lib/jquery-3.4.1/jquery-3.4.1.min.js"></script>
    <script src="../../js/lay-module/layuimini/miniTab.js"></script>
    <script src="../../frontstatic/js/notify.js"></script>
    <script src="../../frontstatic/js/notify_stand.js"></script>
</head>
<body>
<form class="layui-form" style="margin-left: -30px">
    <div class="layui-form-item" id="brandAdddiv">
        <label class="layui-form-label">品牌名称：</label>
        <div class="layui-input-inline">
            <input autocomplete="off" class="layui-input" id="BrandName" lay-verify="required" placeholder="请输入品牌名称"
                   required type="text">
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input-block" style="margin-top: 50px;margin-left: 190px">
            <button class="layui-btn layui-btn-normal" id="addBrandBtn" type="button">确定</button>
        </div>
    </div>
</form>
</body>
<script>
    var notify;
    layui.use(['notify'],function(){
        notify=layui.notify;
    })
    layui.use('form', function () {
        var layer = layui.layer;

        $("#addBrandBtn").on('click', function () {
            var val = $("#BrandName").val();
            if (val == "") {
                notify.error("输入不能为空")
            } else {
                $.post("/brand/addData", {"brandName": val}, function (ex) {
                    if (ex.code==0) {
                        var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                        parent.layer.close(index);
                    }else {
                    }
                })
            }
        })
    })

</script>
</html>